package com.example.feignapi.article;

import com.example.common.util.R;
import com.example.feignapi.article.fallback.ArticleClientFallback;
import com.example.model.article.dto.ArticleCommentDto;
import com.example.model.article.dto.ArticleDto;
import com.example.model.comment.dto.CommentConfigDto;
import com.example.model.wemedia.dto.StatisticsDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

@FeignClient(value = "leadnews-article", path = "/api/v1/", fallback = ArticleClientFallback.class)
public interface ArticleClient {
    @PostMapping(value = "/article/addArticle")
    R addArticle(@RequestBody ArticleDto articleDto);

    @GetMapping(value = "/article/queryLikesAndConllections")
    R queryLikesAndConllections(@RequestParam("userId") Integer userId,
                                             @RequestParam("beginDate") Date beginDate,
                                             @RequestParam("endDate") Date endDate);

    @PostMapping(value = "/article/getNewPage/{page}/{pageSize}")
    R getNewPage(@RequestBody StatisticsDto statisticsDto, @PathVariable(value = "page") Long page, @PathVariable(value = "pageSize") Long pageSize);

    @GetMapping(value = "/articleConfig/getArticleConfigByArticleId/{articleId}")
    R getArticleConfigByArticleId(@PathVariable("articleId") Long articleId);

    @PostMapping(value = "/article/getNewsComments/{page}/{pageSize}")
    R getNewsCommentsPage(@RequestBody ArticleCommentDto articleCommentDto, @PathVariable(value = "page") Long page, @PathVariable(value = "pageSize") Long pageSize);

    @PostMapping(value = "/articleConfig/updateCommentStatus")
    R updateCommentStatus(@RequestBody CommentConfigDto commentConfigDto);
}
